package io.renren.membermanage.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import io.renren.membermanage.bo.KeywordListBO;
import io.renren.membermanage.service.KeywordService;
import io.renren.util.ApiResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/keyword")
@Tag(name = "关键词管理")
public class KeywordController {

    @Resource
    private KeywordService keywordService;

    @SaCheckLogin
    @GetMapping("/getKeywordList")
    @Operation(summary = "获取关键词列表", description = "获取关键词列表")
    @ApiResponses(value ={
            @ApiResponse(responseCode = "200", description = "请求成功",
                    content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema( implementation = KeywordListBO.class)))),
            @ApiResponse(responseCode = "400", description = "请求失败", content = @Content)
    })
    public ApiResult<List<KeywordListBO>> getKeywordList() {
        return ApiResult.success(keywordService.getKeywordList());
    }
}
